//
//  IZHIMGroupManager.h
//  ZHIMCore
//
//  Created by Chen Zhangli on 2021/1/18.
//

#import <UIKit/UIKit.h>
#import "ZHIMGroupManagerDelegate.h"
#import "ZHIMGroup.h"

@protocol IZHIMGroupManager <NSObject>

/// 添加回调代理
/// @param delegate 要添加的代理
- (void)addDelegate:(id<ZHIMGroupManagerDelegate>)delegate;


/// 移除回调代理
/// @param delegate 要移除的代理
- (void)removeDelegate:(id<ZHIMGroupManagerDelegate>)delegate;


/// 获取本地存储的所有群组
- (NSArray *)getJoinedGroups;


/// 从服务器获取自己加入的群组
/// @param pageIndex 页码
/// @param pageSize 每页个数
/// @param completion 完成的回调
- (void)getJoinedGroupsFromServerWithPage:(NSInteger)pageIndex
                                 pageSize:(NSInteger)pageSize
                               completion:(void (^)(NSArray *groups, NSError *error))completion;


/// 查询本地存储的群组
/// @param keyWords 关键字
- (NSArray *)getGroupsByKeyWords:(NSString *)keyWords pageIndex:(NSInteger)pageIndex pageSize:(NSInteger)pageSize;


/// 创建群组
/// @param groupName 群组名称
/// @param announcement 群公告
/// @param notes 群组备注
/// @param invitees 被邀请人
/// @param completion 完成的回调
- (void)createGroupWithName:(NSString *)groupName
               announcement:(NSString *)announcement
                   invitees:(NSArray *)invitees
                      notes:(NSString *)notes
                 completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 获取群组详情
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)getGroupInfoFromServerWithId:(NSString *)groupId
                          completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 获取群组成员列表
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)getGroupMemberListFromServerWithId:(NSString *)groupId
                                completion:(void (^)(NSArray *members, NSError *error))completion;


/// 获取群组黑名单列表（暂不支持）
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)getGroupBlackListFromServerWithId:(NSString *)groupId
                               completion:(void (^)(NSArray *blackList, NSError *error))completion;


/// 获取群组被禁言列表（暂不支持）
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)getGroupMuteListFromServerWithId:(NSString *)groupId
                              completion:(void (^)(NSArray *muteList, NSError *error))completion;


/// 获取群组白名单列表（暂不支持）
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)getGroupWhiteListFromServerWithId:(NSString *)groupId
                               completion:(void (^)(NSArray *whiteList, NSError *error))completion;


/// 获取群公告
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)getGroupAnnouncementWithId:(NSString *)groupId
                        completion:(void (^)(NSString *announcement, NSError *error))completion;


/// 加入群组
/// @param groupId 群组Id
/// @param message 请求加入的信息
/// @param completion 完成的回调
- (void)requestToJoinGroup:(NSString *)groupId
                   message:(NSString *)message
                completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 批准入群申请（暂不支持）
/// @param groupId 所申请的群组ID
/// @param userId 申请人
/// @param completion 完成的回调
- (void)approveJoinGroupRequest:(NSString *)groupId
                         sender:(NSString *)userId
                     completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 拒绝入群申请（暂不支持）
/// @param groupId 被拒绝的群组ID
/// @param userId 申请人
/// @param reason 拒绝理由
/// @param completion 完成的回调
- (void)declineJoinGroupRequest:(NSString *)groupId
                         sender:(NSString *)userId
                         reason:(NSString *)reason
                     completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 邀请用户加入群组
/// @param users 被邀请的用户名列表
/// @param groupId 群组Id
/// @param message 欢迎信息
/// @param completion 完成的回调
- (void)addMembers:(NSArray *)users
           toGroup:(NSString *)groupId
           message:(NSString *)message
        completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 接受入群邀请（暂不支持）
/// @param groupId 接受的群组Id
/// @param inviter 邀请者
/// @param completion 完成的回调
- (void)acceptInvitationFromGroup:(NSString *)groupId
                          inviter:(NSString *)inviter
                       completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 拒绝入群邀请（暂不支持）
/// @param groupId 被拒绝的群组Id
/// @param inviter 邀请人
/// @param reason  拒绝理由
/// @param completion 完成的回调
- (void)declineGroupInvitation:(NSString *)groupId
                       inviter:(NSString *)inviter
                        reason:(NSString *)reason
                    completion:(void (^)(NSError *error))completion;


/// 将群成员移出群组
/// @param users 要移出群组的用户列表
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)removeMembers:(NSArray *)users
            fromGroup:(NSString *)groupId
           completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 加人到群组黑名单（暂不支持）
/// @param members 要加入黑名单的用户
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)blockMembers:(NSArray *)members
           fromGroup:(NSString *)groupId
          completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 从群组黑名单中减人（暂不支持）
/// @param members 要从黑名单中移除的用户名列表
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)unblockMembers:(NSArray *)members
             fromGroup:(NSString *)groupId
            completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 更改群组名称
/// @param groupName 新名称
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)updateGroupName:(NSString *)groupName
                  forGroup:(NSString *)groupId
                completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 更改群组备注
/// @param notes 备注
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)updateNotes:(NSString *)notes
                 forGroup:(NSString *)groupId
               completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 修改群公告
/// @param announcement 群公告
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)updateAnnouncement:(NSString *)announcement
                  forGroup:(NSString *)groupId
                completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 修改群头像
/// @param image 新头像
/// @param groupId 群组Id
- (void)updateAvatar:(UIImage *)image
            forGroup:(NSString *)groupId;

/// 退出群组
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)leaveGroup:(NSString *)groupId
        completion:(void (^)(NSError *error))completion;


/// 解散群组
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)destroyGroup:(NSString *)groupId
          completion:(void (^)(NSError *error))completion;


/// 屏蔽群消息（暂不支持）
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)blockGroup:(NSString *)groupId
        completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 取消屏蔽群消息（暂不支持）
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)unblockGroup:(NSString *)groupId
          completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 改变群主（暂不支持）
/// @param groupId 群组Id
/// @param newOwnerId 新群主
/// @param completion 完成的回调
- (void)updateGroupOwner:(NSString *)groupId
                newOwner:(NSString *)newOwnerId
              completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 添加群组管理员（暂不支持）
/// @param admin 要添加的群组管理员
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)addAdmin:(NSString *)admin
         toGroup:(NSString *)groupId
      completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 移除群组管理员（暂不支持）
/// @param admin 要移除的群组管理员
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)removeAdmin:(NSString *)admin
          fromGroup:(NSString *)groupId
         completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 将一组成员禁言（暂不支持）
/// @param muteMembers 要禁言的成员列表
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)muteMembers:(NSArray *)muteMembers
          fromGroup:(NSString *)groupId
         completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 解除禁言（暂不支持）
/// @param members 被解除的列表
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)unmuteMembers:(NSArray *)members
            fromGroup:(NSString *)groupId
           completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 全员禁言（暂不支持）
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)muteAllMembersFromGroup:(NSString *)groupId
                     completion:(void (^)(ZHIMGroup *group, NSError *error))completion;


/// 解除全员禁言（暂不支持）
/// @param groupId 群组Id
/// @param completion 完成的回调
- (void)unmuteAllMembersFromGroup:(NSString *)groupId
                       completion:(void (^)(ZHIMGroup *group, NSError *error))completion;

@end
